-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use GitHub Actions for linting and testing as well as update gemspec #71
Conversation
a438249
to
cfaae6f
Compare
merge: | ||
- Exclude | ||
|
||
require: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe later we can add rubocop-performance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
Style/StringLiterals: | ||
Enabled: true | ||
EnforcedStyle: single_quotes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default, is your intention here to be explicit on these style decisions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I agree that we should use as many defaults as possible. For some rules that have a large "surface", I would mark them explicitly.
.rubocop.yml
Outdated
# Enforce comma after the last item of a multiline array or hash | ||
Style/TrailingCommaInArrayLiteral: | ||
Enabled: true | ||
EnforcedStyleForMultiline: comma |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern doesn't follow the recommended Ruby Programming Style. I would recommend following up to use default styling for this, Style/TrailingCommaInHashLiteral
, and Style/TrailingCommaInArguments
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense.
EnforcedStyle: trailing | ||
|
||
Layout/LineLength: | ||
Max: 120 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default value. Recommend removing things that are default to reduce config size.
.rubocop.yml
Outdated
|
||
# Allow guard clauses | ||
Style/GuardClause: | ||
Enabled: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabled by default.
.rubocop.yml
Outdated
|
||
# Naming conventions | ||
Naming/PredicateName: | ||
Enabled: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabled by default.
.rubocop.yml
Outdated
|
||
Metrics/BlockLength: | ||
Max: 50 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
Example: | ||
|
||
```ruby | ||
ICU::Transliteration.transliterate('Traditional-Simplified', '沈從文') # => "沈从文" | ||
``` | ||
|
||
Locale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing these examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I made a mistake.
lib/ffi-icu/locale.rb
Outdated
# rubocop:disable Style/OptionalBooleanParameter | ||
def to_language_tag(strict = false) | ||
Lib::Util.read_string_buffer(64) do |buffer, status| | ||
Lib.uloc_toLanguageTag(@id, buffer, buffer.size, strict ? 1 : 0, status) | ||
end | ||
end | ||
# rubocop:enable Style/OptionalBooleanParameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These enable/disable cop comments it can also be done on one line.
# rubocop:disable Style/OptionalBooleanParameter | |
def to_language_tag(strict = false) | |
Lib::Util.read_string_buffer(64) do |buffer, status| | |
Lib.uloc_toLanguageTag(@id, buffer, buffer.size, strict ? 1 : 0, status) | |
end | |
end | |
# rubocop:enable Style/OptionalBooleanParameter | |
def to_language_tag(strict = false) # rubocop:disable Style/OptionalBooleanParameter | |
Lib::Util.read_string_buffer(64) do |buffer, status| | |
Lib.uloc_toLanguageTag(@id, buffer, buffer.size, strict ? 1 : 0, status) | |
end | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with some other files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
lib/ffi-icu/version.rb
Outdated
@@ -1,3 +1,3 @@ | |||
module ICU | |||
VERSION = "0.5.3" | |||
VERSION = '0.5.3'.freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the # frozen_string_literal: true
comment could help. Related cop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small fix, but overall looks really good 👍🏼
.rubocop.yml
Outdated
Include: | ||
- '*.gemspec' | ||
|
||
# ALlow no documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# ALlow no documentation. | |
# Allow no documentation. |
- Use simpler syntax for README - Update LICENSE date - Set up changelog
21be71e
to
e72e108
Compare
0d0c513
to
7b0452a
Compare
Add GitHub workflows for linting and testing.
This PR also uses rubocop and update a few gemspec defintions.
It would be nice to move to minitest.